<template>
   <div>
      <h1>父组件</h1>
       <button @click="changeChildData">更改子组件中的count</button>
      <hr>
      <Son ref="sonComponent"></Son>
   </div>
</template>

<script>
import Son from './Son.vue'
export default {
    components:{
        Son
    },
    methods:{
        changeChildData(){
            //获取子组件中的data中的count数组
            console.log(this.$refs.sonComponent.count);
            this.$refs.sonComponent.changeNum()
             console.log(this.$refs.sonComponent.count);
        }
    }
}
</script>

<style>

</style>